/* ATTENTION! This file was generated automatically! Don't change it!!!
----------------------------------------------------------------------- */
( function() { "use strict"; var ua = navigator.userAgent.toLowerCase(); if ( ( ua.indexOf( 'webkit' ) > -1 || ua.indexOf( 'opera' ) > -1 || ua.indexOf( 'msie' ) > -1 ) && document.getElementById && window.addEventListener ) { window.addEventListener( 'hashchange', function() { var element = document.getElementById( location.hash.substring( 1 ) ); if ( element ) { if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.nodeName ) ) { element.tabIndex = -1; } element.focus(); } }, false ); } } )(); (function(){ "use strict"; var $window = jQuery( window ), $document = jQuery( document ), $adminbar = jQuery( '#wpadminbar' ), $body = jQuery( 'body' ); if (typeof PLANTY_STORAGE == 'undefined') { window.PLANTY_STORAGE = {}; } window.planty_storage_get = function(var_name) { return planty_isset( PLANTY_STORAGE[var_name] ) ? PLANTY_STORAGE[var_name] : ''; }; window.planty_storage_set = function(var_name, value) { PLANTY_STORAGE[var_name] = value; }; window.planty_storage_inc = function(var_name) { var value = arguments[1] === undefined ? 1 : arguments[1]; PLANTY_STORAGE[var_name] += value; }; window.planty_storage_concat = function(var_name, value) { PLANTY_STORAGE[var_name] += '' + value; }; window.planty_storage_get_array = function(var_name, key) { return planty_isset( PLANTY_STORAGE[var_name][key] ) ? PLANTY_STORAGE[var_name][key] : ''; }; window.planty_storage_set_array = function(var_name, key, value) { if ( ! planty_isset( PLANTY_STORAGE[var_name] )) { PLANTY_STORAGE[var_name] = {}; } PLANTY_STORAGE[var_name][key] = value; }; window.planty_storage_inc_array = function(var_name, key) { var value = arguments[2] === undefined ? 1 : arguments[2]; PLANTY_STORAGE[var_name][key] += value; }; window.planty_storage_concat_array = function(var_name, key, value) { PLANTY_STORAGE[var_name][key] += '' + value; }; window.planty_isset = function(obj) { return typeof(obj) != 'undefined'; }; window.planty_empty = function(obj) { return typeof(obj) == 'undefined' || (typeof(obj) == 'object' && obj === null) || (typeof(obj) == 'array' && obj.length === 0) || (typeof(obj) == 'string' && planty_alltrim( obj ) === '') || obj === 0; }; window.planty_is_array = function(obj) { return typeof(obj) == 'array'; }; window.planty_is_object = function(obj) { return typeof(obj) == 'object'; }; window.planty_clone_object = function(obj) { if (obj === null || typeof(obj) != 'object') { return obj; } var temp = {}; for (var key in obj) { temp[key] = planty_clone_object( obj[key] ); } return temp; }; window.planty_merge_objects = function(obj1, obj2) { for (var i in obj2) { obj1[i] = obj2[i]; } return obj1; }; window.planty_array_merge = function(a1, a2) { for (var i in a2) { a1[i] = a2[i]; } return a1; }; window.planty_array_first_key = function(arr) { var rez = null; for (var i in arr) { rez = i; break; } return rez; }; window.planty_array_first_value = function(arr) { var rez = null; for (var i in arr) { rez = arr[i]; break; } return rez; }; window.planty_serialize = function(mixed_val) { var obj_to_array = arguments.length == 1 || argument[1] === true; switch (typeof(mixed_val)) { case "number": if (isNaN( mixed_val ) || ! isFinite( mixed_val )) { return false; } else { return (Math.floor( mixed_val ) == mixed_val ? "i" : "d") + ":" + mixed_val + ";"; } case "string": return "s:" + mixed_val.length + ":\"" + mixed_val + "\";"; case "boolean": return "b:" + (mixed_val ? "1" : "0") + ";"; case "object": if (mixed_val == null) { return "N;"; } else if (mixed_val instanceof Array) { var idxobj = { idx: -1 }; var map = []; for (var i = 0; i < mixed_val.length; i++) { idxobj.idx++; var ser = planty_serialize( mixed_val[i] ); if (ser) { map.push( planty_serialize( idxobj.idx ) + ser ); } } return "a:" + mixed_val.length + ":{" + map.join( "" ) + "}"; } else { var class_name = planty_get_class( mixed_val ); if (class_name == undefined) { return false; } var props = new Array(); for (var prop in mixed_val) { var ser = planty_serialize( mixed_val[prop] ); if (ser) { props.push( planty_serialize( prop ) + ser ); } } if (obj_to_array) { return "a:" + props.length + ":{" + props.join( "" ) + "}"; } else { return "O:" + class_name.length + ":\"" + class_name + "\":" + props.length + ":{" + props.join( "" ) + "}"; } } case "undefined": return "N;"; } return false; }; ( function( $ ) { var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a256 = '', r64 = [256], r256 = [256], i = 0; var UTF8 = { encode: function(strUni) { var strUtf = strUni .replace( /[\u0080-\u07ff]/g, function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xc0 | cc >> 6, 0x80 | cc & 0x3f); } ) .replace( /[\u0800-\uffff]/g, function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xe0 | cc >> 12, 0x80 | cc >> 6 & 0x3F, 0x80 | cc & 0x3f); } ); return strUtf; }, decode: function(strUtf) { var strUni = strUtf .replace( /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, function(c) { var cc = ((c.charCodeAt(0) & 0x0f) << 12) | ((c.charCodeAt(1) & 0x3f) << 6) | (c.charCodeAt(2) & 0x3f); return String.fromCharCode(cc); } ) .replace( /[\u00c0-\u00df][\u0080-\u00bf]/g, function(c) { var cc = (c.charCodeAt(0) & 0x1f) << 6 | c.charCodeAt(1) & 0x3f; return String.fromCharCode(cc); } ); return strUni; } }; while( i < 256 ) { var c = String.fromCharCode(i); a256 += c; r256[i] = i; r64[i] = b64.indexOf(c); ++i; } function code(s, discard, alpha, beta, w1, w2) { s = String(s); var buffer = 0, i = 0, length = s.length, result = '', bitsInBuffer = 0; while (i < length) { var c = s.charCodeAt(i); c = c < 256 ? alpha[c] : -1; buffer = (buffer << w1) + c; bitsInBuffer += w1; while (bitsInBuffer >= w2) { bitsInBuffer -= w2; var tmp = buffer >> bitsInBuffer; result += beta.charAt(tmp); buffer ^= tmp << bitsInBuffer; } ++i; } if ( ! discard && bitsInBuffer > 0) { result += beta.charAt(buffer << (w2 - bitsInBuffer)); } return result; } var Plugin = $.planty_encoder = function(dir, input, encode) { return input ? Plugin[dir](input, encode) : dir ? null : this; }; Plugin.btoa = Plugin.encode = function(plain, utf8encode) { plain = Plugin.raw === false || Plugin.utf8encode || utf8encode ? UTF8.encode(plain) : plain; plain = code(plain, false, r256, b64, 8, 6); return plain + '===='.slice((plain.length % 4) || 4); }; Plugin.atob = Plugin.decode = function(coded, utf8decode) { coded = String(coded).split('='); var i = coded.length; do { --i; coded[i] = code(coded[i], true, r64, a256, 6, 8); } while (i > 0); coded = coded.join(''); return Plugin.raw === false || Plugin.utf8decode || utf8decode ? UTF8.decode(coded) : coded; }; }(jQuery) ); window.planty_get_class = function(obj) { if (obj instanceof Object && ! (obj instanceof Array) && ! (obj instanceof Function) && obj.constructor) { var arr = obj.constructor.toString().match( /function\s*(\w+)/ ); if (arr && arr.length == 2) { return arr[1]; } } return false; }; window.planty_debounce = function(func, wait) { var timeout; return function () { var context = this, args = arguments; var later = function later() { timeout = null; func.apply(context, args); }; var callNow = !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) { func.apply(context, args); } }; }; window.planty_throttle = function(func, wait, debounce) { var timeout; return function () { var context = this, args = arguments; var throttler = function () { timeout = null; func.apply(context, args); }; if (debounce) clearTimeout(timeout); if (debounce || !timeout) timeout = setTimeout(throttler, wait); }; }; var planty_observers = {}; window.planty_create_observer = function( id, obj, callback, args ) { if ( typeof window.trx_addons_create_observer != 'undefined' ) { return trx_addons_create_observer( id, obj, callback, args ); } else if ( typeof window.MutationObserver !== 'undefined' && obj.length > 0 ) { if ( typeof planty_observers[ id ] == 'undefined' ) { var defa = { attributes: false, childList: true, subtree: true }; if ( args ) { defa = planty_object_merge( defa, args ); } planty_observers[ id ] = { observer: new MutationObserver( callback ), obj: obj.get(0) }; planty_observers[ id ].observer.observe( planty_observers[ id ].obj, defa ); } return true; } return false; }; window.planty_remove_observer = function( id ) { if ( typeof window.trx_addons_remove_observer != 'undefined' ) { return trx_addons_remove_observer( id ); } else if ( typeof window.MutationObserver !== 'undefined' ) { if ( typeof planty_observers[ id ] !== 'undefined' ) { planty_observers[ id ].observer.disconnect( planty_observers[ id ].obj ); delete planty_observers[ id ]; } return true; } return false; }; var filters = {}; window.planty_add_filter = function( filter, callback, priority ) { if ( typeof window.trx_addons_add_filter != 'undefined' ) { trx_addons_add_filter( filter, callback, priority ); } else if ( typeof wp != 'undefined' && typeof wp.hooks != 'undefined' ) { wp.hooks.addFilter( filter, 'planty', callback, priority == undefined ? 10 : priority ); } else { if ( ! filters[filter] ) filters[filter] = {}; if ( ! filters[filter][priority] ) filters[filter][priority] = []; filters[filter][priority].push( callback ); } }; window.planty_apply_filters = function( filter, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ) { if ( typeof window.trx_addons_apply_filters != 'undefined' ) { arg1 = trx_addons_apply_filters( filter, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ); } else if ( typeof wp != 'undefined' && typeof wp.hooks != 'undefined' && typeof wp.hooks.applyFilters != 'undefined' ) { arg1 = wp.hooks.applyFilters( filter, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ); } else if ( typeof filters[filter] == 'object' ) { var keys = Object.keys(filters[filter]).sort(); for (var i=0; i < keys.length; i++ ) { for (var j=0; j < filters[filter][keys[i]].length; j++ ) { if ( typeof filters[filter][keys[i]][j] == 'function' ) { arg1 = filters[filter][keys[i]][j](arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } } } } return arg1; }; window.planty_add_action = function( action, callback, priority ) { if ( typeof window.trx_addons_add_action != 'undefined' ) { trx_addons_add_action( action, callback, priority ); } else if ( typeof wp != 'undefined' && typeof wp.hooks != 'undefined' ) { wp.hooks.addAction( action, 'planty', callback, priority == undefined ? 10 : priority ); } else { planty_add_filter( action, callback, priority ); } }; window.planty_do_action = function( action, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ) { if ( typeof window.trx_addons_do_action != 'undefined' ) { trx_addons_do_action( action, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ); } else if ( typeof wp != 'undefined' && typeof wp.hooks != 'undefined' && typeof wp.hooks.doActions != 'undefined' ) { wp.hooks.doActions( action, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ); } else { planty_apply_filters( action, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ); } }; window.planty_in_list = function(str, list) { var delim = arguments[2] !== undefined ? arguments[2] : '|'; var icase = arguments[3] !== undefined ? arguments[3] : true; var retval = false; if (icase) { if (typeof(str) == 'string') { str = str.toLowerCase(); } list = list.toLowerCase(); } var parts = list.split( delim ); for (var i = 0; i < parts.length; i++) { if (parts[i] == str) { retval = true; break; } } return retval; }; window.planty_alltrim = function(str) { var dir = arguments[1] !== undefined ? arguments[1] : 'a'; var rez = ''; var i, start = 0, end = str.length - 1; if (dir == 'a' || dir == 'l') { for (i = 0; i < str.length; i++) { if (str.substr( i, 1 ) != ' ') { start = i; break; } } } if (dir == 'a' || dir == 'r') { for (i = str.length - 1; i >= 0; i--) { if (str.substr( i, 1 ) != ' ') { end = i; break; } } } return str.substring( start, end + 1 ); }; window.planty_ltrim = function(str) { return planty_alltrim( str, 'l' ); }; window.planty_rtrim = function(str) { return planty_alltrim( str, 'r' ); }; window.planty_padl = function(str, len) { var ch = arguments[2] !== undefined ? arguments[2] : ' '; var rez = str.substr( 0, len ); if (rez.length < len) { for (var i = 0; i < len - str.length; i++) { rez += ch; } } return rez; }; window.planty_padr = function(str, len) { var ch = arguments[2] !== undefined ? arguments[2] : ' '; var rez = str.substr( 0, len ); if (rez.length < len) { for (var i = 0; i < len - str.length; i++) { rez = ch + rez; } } return rez; }; window.planty_padc = function(str, len) { var ch = arguments[2] !== undefined ? arguments[2] : ' '; var rez = str.substr( 0, len ); if (rez.length < len) { for (var i = 0; i < Math.floor( (len - str.length) / 2 ); i++) { rez = ch + rez + ch; } } return rez + (rez.length < len ? ch : ''); }; window.planty_replicate = function(str, num) { var rez = ''; for (var i = 0; i < num; i++) { rez += str; } return rez; }; window.planty_prepare_macros = function(str) { return str .replace( /\{\{/g, "" ) .replace( /\}\}/g, "" ) .replace( /\(\(/g, "" ) .replace( /\)\)/g, "" ) .replace( /\|\|/g, "
" ); }; window.planty_round_number = function(num) { var precision = arguments[1] !== undefined ? arguments[1] : 0; var p = Math.pow( 10, precision ); return Math.round( num * p ) / p; }; window.planty_clear_number = function(num) { var precision = arguments[1] !== undefined ? arguments[1] : 0; var defa = arguments[2] !== undefined ? arguments[2] : 0; var res = ''; var decimals = -1; num = "" + num; if (num == "") { num = "" + defa; } for (var i = 0; i < num.length; i++) { if (decimals == 0) { break; } else if (decimals > 0) { decimals--; } var ch = num.substr( i,1 ); if (ch == '.') { if (precision > 0) { res += ch; } decimals = precision; } else if ((ch >= 0 && ch <= 9) || (ch == '-' && i == 0)) { res += ch; } } if (precision > 0 && decimals != 0) { if (decimals == -1) { res += '.'; decimals = precision; } for (i = decimals; i > 0; i--) { res += '0'; } } return res; }; window.planty_dec2hex = function(n) { return Number( n ).toString( 16 ); }; window.planty_hex2dec = function(hex) { return parseInt( hex,16 ); }; window.planty_in_array = function(val, thearray) { var rez = false; for (var i = 0; i < thearray.length - 1; i++) { if (thearray[i] == val) { rez = true; break; } } return rez; }; window.planty_sort_array = function(thearray) { var caseSensitive = arguments[1] !== undefined ? arguments[1] : false; var tmp = ''; for (var x = 0; x < thearray.length - 1; x++) { for (var y = (x + 1); y < thearray.length; y++) { if (caseSensitive) { if (thearray[x] > thearray[y]) { tmp = thearray[x]; thearray[x] = thearray[y]; thearray[y] = tmp; } } else { if (thearray[x].toLowerCase() > thearray[y].toLowerCase()) { tmp = thearray[x]; thearray[x] = thearray[y]; thearray[y] = tmp; } } } } return thearray; }; window.planty_parse_date = function(dt) { dt = dt.replace( /\//g, '-' ).replace( /\./g, '-' ).replace( /T/g, ' ' ).split( '+' )[0]; var dt2 = dt.split( ' ' ); var d = dt2[0].split( '-' ); var t = dt2[1].split( ':' ); d.push( t[0], t[1], t[2] ); return d; }; window.planty_get_date_difference = function(dt1) { var dt2 = arguments[1] !== undefined ? arguments[1] : ''; var short_date = arguments[2] !== undefined ? arguments[2] : true; var sec = arguments[3] !== undefined ? arguments[3] : false; var a1 = planty_parse_date( dt1 ); dt1 = Date.UTC( a1[0], a1[1], a1[2], a1[3], a1[4], a1[5] ); if (dt2 == '') { dt2 = new Date(); var a2 = [dt2.getFullYear(), dt2.getMonth() + 1, dt2.getDate(), dt2.getHours(), dt2.getMinutes(), dt2.getSeconds()]; } else { var a2 = planty_parse_date( dt2 ); } dt2 = Date.UTC( a2[0], a2[1], a2[2], a2[3], a2[4], a2[5] ); var diff = Math.round( (dt2 - dt1) / 1000 ); var days = Math.floor( diff / (24 * 3600) ); diff -= days * 24 * 3600; var hours = Math.floor( diff / 3600 ); diff -= hours * 3600; var minutes = Math.floor( diff / 60 ); diff -= minutes * 60; var rez = ''; if (days > 0) { rez += (rez !== '' ? ' ' : '') + days + ' day' + (days > 1 ? 's' : ''); } if (( ! short_date || rez == '') && hours > 0) { rez += (rez !== '' ? ' ' : '') + hours + ' hour' + (hours > 1 ? 's' : ''); } if (( ! short_date || rez == '') && minutes > 0) { rez += (rez !== '' ? ' ' : '') + minutes + ' minute' + (minutes > 1 ? 's' : ''); } if (sec || rez == '') { rez += rez !== '' || sec ? (' ' + diff + ' second' + (diff > 1 ? 's' : '')) : 'less then minute'; } return rez; }; window.planty_hex2rgb = function(hex) { hex = parseInt( ((hex.indexOf( '#' ) > -1) ? hex.substring( 1 ) : hex), 16 ); return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)}; }; window.planty_hex2rgba = function(hex, alpha) { var rgb = planty_hex2rgb( hex ); return 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + alpha + ')'; }; window.planty_rgb2hex = function(color) { var aRGB; color = color.replace( /\s/g,"" ).toLowerCase(); if (color == 'rgba(0,0,0,0)' || color == 'rgba(0%,0%,0%,0%)') { color = 'transparent'; } if (color.indexOf( 'rgba(' ) == 0) { aRGB = color.match( /^rgba\((\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?)\)$/i ); } else { aRGB = color.match( /^rgb\((\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?)\)$/i ); } if (aRGB) { color = ''; for (var i = 1; i <= 3; i++) { color += Math.round( (aRGB[i][aRGB[i].length - 1] == "%" ? 2.55 : 1) * parseInt( aRGB[i] ) ).toString( 16 ).replace( /^(.)$/,'0$1' ); } } else { color = color.replace( /^#?([\da-f])([\da-f])([\da-f])$/i, '$1$1$2$2$3$3' ); } return (color.substr( 0,1 ) != '#' ? '#' : '') + color; }; window.planty_components2hex = function(r,g,b) { return '#' + Number( r ).toString( 16 ).toUpperCase().replace( /^(.)$/,'0$1' ) + Number( g ).toString( 16 ).toUpperCase().replace( /^(.)$/,'0$1' ) + Number( b ).toString( 16 ).toUpperCase().replace( /^(.)$/,'0$1' ); }; window.planty_rgb2components = function(color) { color = planty_rgb2hex( color ); var matches = color.match( /^#?([\dabcdef]{2})([\dabcdef]{2})([\dabcdef]{2})$/i ); if ( ! matches) { return false; } for (var i = 1, rgb = new Array( 3 ); i <= 3; i++) { rgb[i - 1] = parseInt( matches[i],16 ); } return rgb; }; window.planty_hex2hsb = function(hex) { var h = arguments[1] !== undefined ? arguments[1] : 0; var s = arguments[2] !== undefined ? arguments[2] : 0; var b = arguments[3] !== undefined ? arguments[3] : 0; var hsb = planty_rgb2hsb( planty_hex2rgb( hex ) ); hsb.h = Math.min( 359, Math.max( 0, hsb.h + h ) ); hsb.s = Math.min( 100, Math.max( 0, hsb.s + s ) ); hsb.b = Math.min( 100, Math.max( 0, hsb.b + b ) ); return hsb; }; window.planty_hsb2hex = function(hsb) { var rgb = planty_hsb2rgb( hsb ); return planty_components2hex( rgb.r, rgb.g, rgb.b ); }; window.planty_rgb2hsb = function(rgb) { var hsb = {}; hsb.b = Math.max( Math.max( rgb.r,rgb.g ),rgb.b ); hsb.s = (hsb.b <= 0) ? 0 : Math.round( 100 * (hsb.b - Math.min( Math.min( rgb.r,rgb.g ),rgb.b )) / hsb.b ); hsb.b = Math.round( (hsb.b / 255) * 100 ); if ((rgb.r == rgb.g) && (rgb.g == rgb.b)) { hsb.h = 0; } else if (rgb.r >= rgb.g && rgb.g >= rgb.b) { hsb.h = 60 * (rgb.g - rgb.b) / (rgb.r - rgb.b); } else if (rgb.g >= rgb.r && rgb.r >= rgb.b) { hsb.h = 60 + 60 * (rgb.g - rgb.r) / (rgb.g - rgb.b); } else if (rgb.g >= rgb.b && rgb.b >= rgb.r) { hsb.h = 120 + 60 * (rgb.b - rgb.r) / (rgb.g - rgb.r); } else if (rgb.b >= rgb.g && rgb.g >= rgb.r) { hsb.h = 180 + 60 * (rgb.b - rgb.g) / (rgb.b - rgb.r); } else if (rgb.b >= rgb.r && rgb.r >= rgb.g) { hsb.h = 240 + 60 * (rgb.r - rgb.g) / (rgb.b - rgb.g); } else if (rgb.r >= rgb.b && rgb.b >= rgb.g) { hsb.h = 300 + 60 * (rgb.r - rgb.b) / (rgb.r - rgb.g); } else { hsb.h = 0; } hsb.h = Math.round( hsb.h ); return hsb; }; window.planty_hsb2rgb = function(hsb) { var rgb = {}; var h = Math.round( hsb.h ); var s = Math.round( hsb.s * 255 / 100 ); var v = Math.round( hsb.b * 255 / 100 ); if (s == 0) { rgb.r = rgb.g = rgb.b = v; } else { var t1 = v; var t2 = (255 - s) * v / 255; var t3 = (t1 - t2) * (h % 60) / 60; if (h == 360) { h = 0; } if (h < 60) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; } else if (h < 120) { rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; } else if (h < 180) { rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; } else if (h < 240) { rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; } else if (h < 300) { rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; } else if (h < 360) { rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; } else { rgb.r = 0; rgb.g = 0; rgb.b = 0; } } return { r:Math.round( rgb.r ), g:Math.round( rgb.g ), b:Math.round( rgb.b ) }; }; window.planty_color_picker = function(){ var id = arguments[0] !== undefined ? arguments[0] : "iColorPicker" + Math.round( Math.random() * 1000 ); var colors = arguments[1] !== undefined ? arguments[1] : '#f00,#ff0,#0f0,#0ff,#00f,#f0f,#fff,#ebebeb,#e1e1e1,#d7d7d7,#cccccc,#c2c2c2,#b7b7b7,#acacac,#a0a0a0,#959595,' + '#ee1d24,#fff100,#00a650,#00aeef,#2f3192,#ed008c,#898989,#7d7d7d,#707070,#626262,#555,#464646,#363636,#262626,#111,#000,' + '#f7977a,#fbad82,#fdc68c,#fff799,#c6df9c,#a4d49d,#81ca9d,#7bcdc9,#6ccff7,#7ca6d8,#8293ca,#8881be,#a286bd,#bc8cbf,#f49bc1,#f5999d,' + '#f16c4d,#f68e54,#fbaf5a,#fff467,#acd372,#7dc473,#39b778,#16bcb4,#00bff3,#438ccb,#5573b7,#5e5ca7,#855fa8,#a763a9,#ef6ea8,#f16d7e,' + '#ee1d24,#f16522,#f7941d,#fff100,#8fc63d,#37b44a,#00a650,#00a99e,#00aeef,#0072bc,#0054a5,#2f3192,#652c91,#91278f,#ed008c,#ee105a,' + '#9d0a0f,#a1410d,#a36209,#aba000,#588528,#197b30,#007236,#00736a,#0076a4,#004a80,#003370,#1d1363,#450e61,#62055f,#9e005c,#9d0039,' + '#790000,#7b3000,#7c4900,#827a00,#3e6617,#045f20,#005824,#005951,#005b7e,#003562,#002056,#0c004b,#30004a,#4b0048,#7a0045,#7a0026'; var colorsList = colors.split( ',' ); var tbl = '
| '; } tbl += ' | |||||||||||||||
| ' + '' + '' + ' | ' + '' + '' + ' | ' + '||||||||||||||
' + (typeof(opt.rules[i].min_length.message) != 'undefined' ? opt.rules[i].min_length.message : opt.error_message_text ) + '
'; error = true; } } if (( ! error || ! opt.exit_after_first_error) && typeof(opt.rules[i].max_length) == 'object') { if (opt.rules[i].max_length.value > 0 && val.length > opt.rules[i].max_length.value) { if (error_msg == '') { jQuery( this ).get( 0 ).focus(); } error_msg += '' + (typeof(opt.rules[i].max_length.message) != 'undefined' ? opt.rules[i].max_length.message : opt.error_message_text ) + '
'; error = true; } } if (( ! error || ! opt.exit_after_first_error) && typeof(opt.rules[i].mask) == 'object') { if (opt.rules[i].mask.value !== '') { var regexp = new RegExp( opt.rules[i].mask.value ); if ( ! regexp.test( val )) { if (error_msg == '') { jQuery( this ).get( 0 ).focus(); } error_msg += '' + (typeof(opt.rules[i].mask.message) != 'undefined' ? opt.rules[i].mask.message : opt.error_message_text ) + '
'; error = true; } } } if (( ! error || ! opt.exit_after_first_error) && typeof(opt.rules[i].state) == 'object') { if (opt.rules[i].state.value == 'checked' && ! jQuery( this ).get( 0 ).checked) { if (error_msg == '') { jQuery( this ).get( 0 ).focus(); } error_msg += '' + (typeof(opt.rules[i].state.message) != 'undefined' ? opt.rules[i].state.message : opt.error_message_text ) + '
'; error = true; } } if (( ! error || ! opt.exit_after_first_error) && typeof(opt.rules[i].equal_to) == 'object') { if (opt.rules[i].equal_to.value !== '' && val != jQuery( jQuery( this ).get( 0 ).form[opt.rules[i].equal_to.value] ).val()) { if (error_msg == '') { jQuery( this ).get( 0 ).focus(); } error_msg += '' + (typeof(opt.rules[i].equal_to.message) != 'undefined' ? opt.rules[i].equal_to.message : opt.error_message_text ) + '
'; error = true; } } if (opt.error_fields_class !== '') { jQuery( this ).toggleClass( opt.error_fields_class, error ); } } } } ); if (error_msg !== '' && opt.error_message_show) { var error_message_box = form.find( ".result" ); if (error_message_box.length == 0) { error_message_box = form.parent().find( ".result" ); } if (error_message_box.length == 0) { form.append( '' ); error_message_box = form.find( ".result" ); } if (opt.error_message_class) { error_message_box.toggleClass( opt.error_message_class, true ); } error_message_box.html( error_msg ).fadeIn(); setTimeout( function() { error_message_box.fadeOut(); }, opt.error_message_time ); } return error_msg !== ''; }; window.trx_addons_document_animate_to_busy = false; window.planty_document_animate_to = function(id) { var split_animation = true; var speed = arguments.length > 1 ? arguments[1] : -1; var callback = arguments.length > 2 ? arguments[2] : undefined; var oft = ! isNaN( id ) ? Number( id ) : 0, oft2 = -1; if (isNaN( id )) { if ( id.substring(0, 1) != '#' && id.substring(0, 1) != '.' ) { id = '#' + id; } var obj = jQuery( id ).eq( 0 ); if (obj.length === 0) { return; } oft = split_animation ? obj.offset().top : Math.max( 0, obj.offset().top - planty_fixed_rows_height() ); if ( split_animation ) { oft2 = Math.max( 0, oft - planty_fixed_rows_height() ); } } if (speed < 0) { speed = Math.min( 1000, Math.max( 300, Math.round( Math.abs( ( oft2 < 0 ? oft : oft2 ) - $window.scrollTop() ) / $window.height() * 300 ) ) ); } if (oft2 >= 0) { setTimeout( function() { if (isNaN( id )) { oft = obj.offset().top; } oft2 = Math.max( 0, oft - planty_fixed_rows_height() ); jQuery( 'body,html' ).stop( true ).animate( {scrollTop: oft2}, Math.floor( speed / 2 ), 'linear', function() { _window_scroll_top = $window.scrollTop(); window.trx_addons_document_animate_to_busy = false; if ( callback ) callback( id, speed ); } ); }, Math.floor( speed / 2 ) ); } else { oft2 = oft; } if ( speed > 0 ) { jQuery( 'body,html' ).stop( true ).animate( { scrollTop: oft2 }, speed, 'linear', function() { _window_scroll_top = $window.scrollTop(); window.trx_addons_document_animate_to_busy = false; if ( callback ) callback( id, speed ); } ); } else { jQuery( 'body,html' ).stop( true ).scrollTop( oft2 ); _window_scroll_top = $window.scrollTop(); window.trx_addons_document_animate_to_busy = false; if ( callback ) callback( id, speed ); } }; var _window_width = $window.width(), _window_height = $window.height(), _window_scroll_top = $window.scrollTop(), _window_scroll_left = $window.scrollLeft(); $window.on( 'resize', function() { _window_width = $window.width(); _window_height = $window.height(); _window_scroll_top = $window.scrollTop(); _window_scroll_left = $window.scrollLeft(); } ); $window.on( 'scroll', function() { _window_scroll_top = $window.scrollTop(); _window_scroll_left = $window.scrollLeft(); } ); window.planty_window_width = function( val ) { if ( val ) _window_width = val; return _window_width; }; window.planty_window_height = function( val ) { if ( val ) _window_height = val; return _window_height; }; window.planty_window_scroll_top = function() { return _window_scroll_top; }; window.planty_window_scroll_left = function() { return _window_scroll_left; }; var _document_height; var _document_height_first_run = true; var _update_document_height = function( e ) { if ( typeof window.trx_addons_document_height == 'undefined' ) { if ( _document_height_first_run && e && e.namespace == 'init_hidden_elements' ) { _document_height_first_run = false; return; } _document_height = $document.height(); } }; $document.ready( _update_document_height ); $document.on( 'action.init_hidden_elements action.got_ajax_response', _update_document_height ); $window.on( 'resize', _update_document_height ); window.planty_document_height = function() { return typeof window.trx_addons_document_height != 'undefined' ? trx_addons_document_height() : _document_height; }; var _adminbar_height = 0; var _update_adminbar_height = function() { if ( typeof window.trx_addons_adminbar_height == 'undefined' ) { _adminbar_height = planty_adminbar_height_calc(); document.querySelector('html').style.setProperty( '--fixed-rows-height', _adminbar_height + 'px' ); } }; $document.ready( _update_adminbar_height ); $window.on( 'resize', _update_adminbar_height ); window.planty_adminbar_height_calc = function() { return planty_apply_filters( 'planty_filter_adminbar_height', $adminbar.length === 0 || $adminbar.css( 'display' ) == 'none' || $adminbar.css( 'position' ) == 'absolute' ? 0 : $adminbar.height() ); }; window.planty_adminbar_height = function() { return typeof window.trx_addons_adminbar_height != 'undefined' ? trx_addons_adminbar_height() : _adminbar_height; }; window.planty_fixed_rows_height = function() { var with_admin_bar = arguments.length > 0 ? arguments[0] : true, with_fixed_rows = arguments.length > 1 ? arguments[1] : true; return typeof trx_addons_fixed_rows_height != 'undefined' ? trx_addons_fixed_rows_height( with_admin_bar, with_fixed_rows ) : ( with_admin_bar ? planty_adminbar_height() : 0 ); }; window.planty_document_set_location = function( curLoc, state ) { try { history.pushState( state ? state : { url: curLoc }, null, curLoc ); return; } catch ( e ) {} location.href = curLoc; }; window.planty_add_to_url = function(loc, prm) { var ignore_empty = arguments[2] !== undefined ? arguments[2] : true; var q = loc.indexOf( '?' ); var attr = {}; if (q > 0) { var qq = loc.substr( q + 1 ).split( '&' ); var parts = ''; for (var i = 0; i < qq.length; i++) { var parts = qq[i].split( '=' ); attr[parts[0]] = parts.length > 1 ? parts[1] : ''; } } for (var p in prm) { attr[p] = prm[p]; } loc = (q > 0 ? loc.substr( 0, q ) : loc) + '?'; var i = 0; for (p in attr) { if (ignore_empty && attr[p] == '') { continue; } loc += (i++ > 0 ? '&' : '') + p + '=' + attr[p]; } return loc; }; window.planty_is_local_link = function(url) { var rez = url !== undefined; if (rez) { var url_pos = url.indexOf( '#' ); if (url_pos == 0 && url.length == 1) { rez = false; } else { if (url_pos < 0) { url_pos = url.length; } var loc = window.location.href; var loc_pos = loc.indexOf( '#' ); if (loc_pos > 0) { loc = loc.substring( 0, loc_pos ); } rez = url_pos == 0; if ( ! rez) { rez = loc == url.substring( 0, url_pos ); } } } return rez; }; window.planty_is_url = function( url ) { return url.indexOf( '//' ) === 0 || url.indexOf( '://' ) > 0; }; window.planty_browser_is_mobile = function() { var check = false; (function(a){if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test( a ) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test( a.substr( 0,4 ) )) { check = true} })( navigator.userAgent || navigator.vendor || window.opera ); return check; }; window.planty_browser_is_ios = function() { return navigator.userAgent.match( /iPad|iPhone|iPod/i ) != null; }; window.planty_is_retina = function() { var mediaQuery = '(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)'; return (window.devicePixelRatio > 1) || (window.matchMedia && window.matchMedia( mediaQuery ).matches); }; window.planty_get_file_name = function(path) { path = path.replace( /\\/g, '/' ); var pos = path.lastIndexOf( '/' ); if (pos >= 0) { path = path.substr( pos + 1 ); } return path; }; window.planty_get_file_ext = function(path) { var pos = path.lastIndexOf( '.' ); path = pos >= 0 ? path.substr( pos + 1 ) : ''; return path; }; window.planty_is_images_loaded = function(cont) { var complete = true; cont.find( 'img' ).each( function() { if ( ! complete) { return; } var img = jQuery( this ).get( 0 ); if (typeof img.complete == 'boolean') { complete = img.complete; } else if (typeof img.naturalWidth == 'number' && typeof img.naturalHeight == 'number') { complete = ! (this.naturalWidth == 0 && this.naturalHeight == 0); } } ); return complete; }; window.planty_when_images_loaded = function(cont, callback, max_delay) { if (max_delay === undefined) { max_delay = 3000; } if (max_delay <= 0 || planty_is_images_loaded( cont )) { callback(); } else { setTimeout( function(){ planty_when_images_loaded( cont, callback, max_delay - 100 ); }, 100 ); } }; window.dcl === undefined && ( window.dcl = function(s) { console.log(s); } ); window.dcs === undefined && ( window.dcs = function() { console.trace(); } ); window.dcts === undefined && ( window.dcts = function( name ) { console.time( name ? name : 'timer' ); } ); window.dctl === undefined && ( window.dctl = function( name ) { console.timeLog( name ? name : 'timer' ); } ); window.dcte === undefined && ( window.dcte = function( name ) { console.timeEnd( name ? name : 'timer' ); } ); })(); jQuery( document ).ready( function() { "use strict"; var ready_busy = true; var theme_init_counter = 0; var $window = jQuery( window ), $document = jQuery( document ), $body = jQuery( 'body' ); var $body_wrap, $page_wrap, $header, $footer, $menu_side_wrap, $menu_side_logo; var _header_height = 0, _footer_height = 0; var $page_content_wrap, $content, $sidebar, $cur_page_title_tag, $single_nav_links_fixed, $single_post_info_fixed, $single_post_scrollers, $stretch_width; var $nav_link_infinite; $document.on( 'action.new_post_added', update_jquery_links ); $document.on( 'action.got_ajax_response', update_jquery_links ); $document.on( 'action.init_hidden_elements', update_jquery_links ); var first_run = true; function update_jquery_links(e) { if ( first_run && e && e.namespace == 'init_hidden_elements' ) { first_run = false; return; } $body_wrap = jQuery( '.body_wrap' ), $page_wrap = jQuery( '.page_wrap' ), $header = jQuery( '.top_panel' ), _header_height = $header.length === 0 ? 0 : $header.height(), $footer = jQuery( '.footer_wrap' ), _footer_height = $footer.length === 0 ? 0 : $footer.height(), $menu_side_wrap = jQuery( '.menu_side_wrap' ), $menu_side_logo = $menu_side_wrap.find( '.sc_layouts_logo' ); $page_content_wrap = jQuery( '.page_content_wrap' ); $content = jQuery( '.content' ); $sidebar = jQuery( '.sidebar:not(.sidebar_fixed_placeholder)' ); $cur_page_title_tag = jQuery('.sc_layouts_title_caption, head title').eq(0); $nav_link_infinite = jQuery( '.nav-links-infinite' ); $single_nav_links_fixed = jQuery( '.nav-links-single.nav-links-fixed' ); $single_post_info_fixed = jQuery( '.post_info_vertical.post_info_vertical_fixed' ); $single_post_scrollers = jQuery( '.nav-links-single-scroll' ); $stretch_width = jQuery( '.trx-stretch-width' ); } update_jquery_links(); planty_intersection_observer_init(); planty_init_actions(); function planty_init_actions() { if (PLANTY_STORAGE['vc_edit_mode'] && jQuery( '.vc_empty-placeholder' ).length === 0 && theme_init_counter++ < 30) { setTimeout( planty_init_actions, 200 ); return; } $window.on( 'resize', function() { planty_resize_actions(); } ); PLANTY_STORAGE['scroll_busy'] = true; $window.on( 'scroll', function() { if (window.requestAnimationFrame) { if ( ! PLANTY_STORAGE['scroll_busy']) { window.requestAnimationFrame( function() { planty_scroll_actions(); }); PLANTY_STORAGE['scroll_busy'] = true; } } else { planty_scroll_actions(); } } ); document.documentElement.className = document.documentElement.className.replace( /\bno-js\b/,'js' ); if (document.documentElement.className.indexOf( PLANTY_STORAGE['site_scheme'] ) == -1) { document.documentElement.className += ' ' + PLANTY_STORAGE['site_scheme']; } planty_ready_actions(); planty_resize_actions(); planty_scroll_actions(); } function planty_ready_actions() { $body .on( 'focus', 'a.planty_skip_link', function() { if ( ! $body.hasClass( 'show_outline' ) ) { $body.addClass( 'show_outline' ); } } ) .on( 'click', 'a.planty_skip_link', function() { var id = jQuery(this).attr('href'); jQuery(id).focus(); } ); $body.on( 'keydown', 'a,input,textarea,select,span[tabindex]', function( e ) { if ( 9 == e.which ) { if ( ! $body.hasClass( 'show_outline' ) ) { $body.addClass( 'show_outline' ); } } } ); $document .on( 'keyup', function(e) { if ( e.keyCode == 27 ) { if ( jQuery( '.menu_mobile.opened' ).length == 1 ) { planty_mobile_menu_close(); e.preventDefault(); return false; } } } ) .on( 'action.trx_addons_inner_links_click', function( e, link_obj, original_e ) { if ( $body.hasClass( 'menu_mobile_opened' ) ) { $body.removeClass( 'menu_mobile_opened' ); planty_mobile_menu_close(); } } ); $document.on( 'action.scroll_planty', function(e) { planty_infinite_scroll_in_blog(); } ); $document.on( 'action.scroll_planty', function(e) { planty_infinite_scroll_in_single(); } ); if ( $body.hasClass('single') ) { planty_add_to_read_list( jQuery('.content > article[data-post-id]').data('post-id') ); } $document.on( 'action.init_hidden_elements', function( e, cont ) { var read_list = planty_get_storage('planty_post_read'); if ( read_list && read_list.charAt(0) == '[' ) { read_list = JSON.parse( read_list ); for ( var p = 0; p < read_list.length; p++ ) { var read_post = cont.find('[data-post-id="' + read_list[ p ] + '"]'); if ( ! read_post.hasClass('full_post_read') && ! read_post.parent().hasClass('content') ) { read_post.addClass('full_post_read'); } } } } ); if ( location.hash == '#comments' || location.hash == '#respond' ) { var $show_comments_button = jQuery( '.show_comments_button' ); if ( $show_comments_button.length == 1 && ! $show_comments_button.hasClass( 'opened' ) ) { $show_comments_button.trigger( 'click' ); planty_document_animate_to( location.hash ); } } $document.trigger( 'action.ready_planty' ); $document.trigger( 'action.prepare_stretch_width' ); $stretch_width = jQuery( '.trx-stretch-width' ); $stretch_width.wrap( '' ); $stretch_width.after( '' ); planty_stretch_width(); $document.on( 'action.init_hidden_elements', planty_init_post_formats ); $document.on( 'action.init_hidden_elements', planty_add_toc_to_sidemenu ); $document.trigger( 'action.init_hidden_elements', [$body.eq(0)] ); } function planty_init_post_formats(e, cont) { planty_init_menus( cont ); planty_add_select_container( cont ); planty_init_bg_video( cont ); planty_init_tabs( cont ); planty_init_accordion( cont ); planty_init_sidebar_control( cont ); planty_init_masonry( cont ); planty_init_load_more( cont ); planty_init_load_single_post( cont ); planty_init_media_elements( cont ); planty_init_video_play_button( cont ); planty_init_comments_button( cont ); planty_init_comments_links( cont ); planty_init_checkbox_i_agree( cont ); } function planty_add_select_container( cont ) { if ( $body.hasClass( 'wp-admin' ) ) { return; } var selector = planty_apply_filters( 'planty_filter_select_container_selector', 'select:not(.esg-sorting-select):not([class*="trx_addons_attrib_"])' ); if ( selector ) { cont.find( selector ).each( function() { var $self = jQuery( this ); if ( $self.css( 'display' ) != 'none' && $self.parents( '.select_container' ).length === 0 && ! $self.next().hasClass( 'select2' ) && ! $self.hasClass( 'select2-hidden-accessible' ) && ! $self.hasClass( 'components-select-control__input' ) ) { var add_class = ''; if ( $self.prop( 'size' ) > 1 ) { add_class += ' select_container_multirows'; } if ( $self.prop( 'multiple' ) ) { add_class += ' select_container_multiple'; } $self.wrap( '' ); if ( $self.parents( planty_apply_filters( 'planty_filter_bubble_submit_form', '.widget_categories' ) ).length > 0 ) { $self.parent().get(0).submit = function() { jQuery(this).closest('form').eq(0).submit(); }; } } } ); } } $document.on( 'ajaxComplete', function(e) { setTimeout( function() { planty_add_select_container( $body ); }, 100 ); } ); function planty_init_bg_video( cont ) { var $top_panel_with_bg_video = cont.find( '.top_panel.with_bg_video:not(.inited)' ).addClass( 'inited' ); if ( PLANTY_STORAGE['background_video'] && $top_panel_with_bg_video.length > 0 && window.Bideo ) { setTimeout( function() { $top_panel_with_bg_video.prepend( '' ); var bv = new Bideo(); bv.init( { videoEl: document.querySelector( '#background_video' ), container: document.querySelector( '.top_panel' ), resize: true, isMobile: window.matchMedia( '(max-width: 768px)' ).matches, playButton: document.querySelector( '#background_video_play' ), pauseButton: document.querySelector( '#background_video_pause' ), src: [ { src: PLANTY_STORAGE['background_video'], type: 'video/' + planty_get_file_ext( PLANTY_STORAGE['background_video'] ) } ], onLoad: function () { } } ); }, 10 ); } else if ( jQuery.fn.tubular ) { cont.find( '#background_video:not(.inited)' ).each( function() { var $self = jQuery( this ).addClass( 'inited' ); var youtube_code = $self.data( 'youtube-code' ); if ( youtube_code ) { $self.tubular( { videoId: youtube_code } ); jQuery( '#tubular-player' ).appendTo( $self ).show(); jQuery( '#tubular-container,#tubular-shield' ).remove(); } } ); } } PLANTY_STORAGE['mejs_attempts'] = 0; function planty_init_media_elements(cont) { var audio_selector = planty_apply_filters( 'planty_filter_mediaelements_audio_selector', 'audio:not(.inited)' ), video_selector = planty_apply_filters( 'planty_filter_mediaelements_video_selector', 'video:not(.inited):not([nocontrols]):not([controls="0"]):not([controls="false"]):not([controls="no"])' ), media_selector = audio_selector + ( audio_selector && video_selector ? ',' : '') + video_selector; if (PLANTY_STORAGE['use_mediaelements'] && cont.find( media_selector ).length > 0) { if ( window.mejs ) { if (window.mejs.MepDefaults) { window.mejs.MepDefaults.enableAutosize = true; } if (window.mejs.MediaElementDefaults) { window.mejs.MediaElementDefaults.enableAutosize = true; } cont.find( 'video.wp-video-shortcode[autoplay],' + 'video.wp-video-shortcode[nocontrols],' + 'video.wp-video-shortcode[controls="0"],' + 'video.wp-video-shortcode[controls="false"],' + 'video.wp-video-shortcode[controls="no"],' + '.wp-block-video > video[autoplay],' + '.wp-block-video > video[nocontrols],' + '.wp-block-video > video[controls="0"],' + '.wp-block-video > video[controls="false"],' + '.wp-block-video > video[controls="no"]' ) .removeClass('wp-video-shortcode'); cont.find( media_selector ).each( function() { var $self = jQuery( this ); if ($self.parents( 'div:hidden,section:hidden,article:hidden' ).length > 0) { return; } if ( ! $self.hasClass( 'no-mejs' ) && ! $self.hasClass( 'no-mediaelement' ) && ! $self.hasClass( 'wp-block-cover__video-background' ) && $self.addClass( 'inited' ).parents( '.mejs-mediaelement' ).length === 0 && $self.parents( '.wp-block-video' ).length === 0 && $self.parents( '.wp-block-media-text' ).length === 0 && $self.parents( '.elementor-background-video-container' ).length === 0 && $self.parents( '.elementor-widget-video' ).length === 0 && $self.parents( '.with_video_autoplay' ).length === 0 && $self.parents( '.sc_layouts_title' ).length === 0 && ( PLANTY_STORAGE['init_all_mediaelements'] || ( ! $self.hasClass( 'wp-audio-shortcode' ) && ! $self.hasClass( 'wp-video-shortcode' ) && ! $self.parent().hasClass( 'wp-playlist' ) ) ) ) { var media_cont = $self.parents('.post_video').eq(0); if ( media_cont.length === 0 ) { media_cont = $self.parents('.video_frame').eq(0); if ( media_cont.length === 0 ) { media_cont = $self.parent(); } } var cont_w = media_cont.length > 0 ? media_cont.width() : -1, cont_h = media_cont.length > 0 ? media_cont.height() : -1, settings = { enableAutosize: true, videoWidth: cont_w, videoHeight: cont_h, audioWidth: '100%', audioHeight: 40, success: function(mejs) { if ( mejs.pluginType && 'flash' === mejs.pluginType && mejs.attributes ) { mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay && mejs.addEventListener( 'canplay', function () { mejs.play(); }, false ); mejs.attributes.loop && 'false' !== mejs.attributes.loop && mejs.addEventListener( 'ended', function () { mejs.play(); }, false ); } } }; $self.mediaelementplayer( settings ); } } ); } else if ( PLANTY_STORAGE['mejs_attempts']++ < 5 ) { setTimeout( function() { planty_init_media_elements( cont ); }, 400 ); } } setTimeout( function() { PLANTY_STORAGE['init_all_mediaelements'] = true; }, 1000 ); } function planty_init_video_play_button( cont ) { cont.find( '.post_featured.with_thumb .post_video_hover:not(.post_video_hover_popup):not(.inited)' ) .addClass( 'inited' ) .on( 'click', function(e) { var $self = jQuery( this ), $post_featured = $self.parents( '.post_featured' ).eq(0).addClass( 'post_video_play' ); if ( typeof trx_addons_insert_video_iframe === 'function' ) { trx_addons_insert_video_iframe( $post_featured.find( '.post_video' ), $self.data('video') ); } else { $post_featured.find( '.post_video' ).html( $self.data( 'video' ) ); } $document.trigger( 'action.init_hidden_elements', [ $post_featured ] ); $window.trigger( 'resize' ); e.preventDefault(); return false; } ) .parents('.post_featured') .on( 'click', function(e) { var $self = jQuery(this); if ( ! $self.hasClass( 'post_video_play' ) && ! jQuery( e.target ).is( 'a' ) && ! jQuery( e.target ).parents( 'a' ).length ) { jQuery(this).find( '.post_video_hover' ).trigger( 'click' ); e.preventDefault(); return false; } } ); } function planty_init_accordion( cont ) { if (jQuery.ui && jQuery.ui.accordion) { cont.find( '.planty_accordion:not(.inited)' ).each( function () { var $self = jQuery( this ); var headers = $self.data( 'headers' ) || '.planty_accordion_title'; var height_style = $self.data( 'height-style' ) || 'content'; var collapsible = $self.data( 'collapsible' ) || false; var init = $self.data( 'active' ); var active = false; if ( isNaN( init ) ) { init = 0; active = $self.find( headers + '[data-active="true"]' ).eq( 0 ); if ( active.length > 0 ) { while ( ! active.parent().hasClass( 'planty_accordion' ) ) { active = active.parent(); } init = active.index(); if ( isNaN( init ) || init < 0 ) init = 0; } } else { init = Math.max( 0, init ); } $self.addClass( 'inited' ).accordion( { 'active': init, 'collapsible': collapsible, 'header': headers, 'heightStyle': height_style, 'create': function( event, ui ) { if ( ui.panel.length > 0 && ! ready_busy ) { $document.trigger( 'action.create_accordion', [ui.panel] ); $document.trigger( 'action.init_hidden_elements', [ui.panel] ); } else if ( active !== false && active.length > 0 ) { active.find( '>' + headers ).trigger( 'click' ); } }, 'activate': function( event, ui ) { if ( ui.oldPanel.length > 0 && ! ready_busy ) { $document.trigger( 'action.deactivate_accordion', [ui.oldPanel] ); } if ( ui.newPanel.length > 0 && ! ready_busy ) { $document.trigger( 'action.activate_accordion', [ui.newPanel] ); $document.trigger( 'action.init_hidden_elements', [ui.newPanel] ); $window.trigger( 'resize' ); } } } ); } ); } } function planty_init_tabs( cont ) { if ( jQuery.ui && jQuery.ui.tabs ) { cont.find( '.planty_tabs:not(.inited)' ).each( function () { var $self = jQuery( this ); var init = $self.data( 'active' ); if ( isNaN( init ) ) { init = 0; var active = $self.find( '> ul > li[data-active="true"]' ).eq( 0 ); if ( active.length > 0 ) { init = active.index(); if (isNaN( init ) || init < 0) { init = 0; } } } else { init = Math.max( 0, init ); } $self.addClass( 'inited' ).tabs( { active: init, show: { effect: 'fadeIn', duration: 300 }, hide: { effect: 'fadeOut', duration: 300 }, create: function( event, ui ) { if ( ui.panel.length > 0 && ! ready_busy ) { $document.trigger( 'action.create_tab', [ui.panel] ); $document.trigger( 'action.init_hidden_elements', [ui.panel] ); } }, activate: function( event, ui ) { if ( ui.oldPanel.length > 0 && ! ready_busy ) { $document.trigger( 'action.deactivate_tab', [ui.oldPanel] ); } if ( ui.newPanel.length > 0 && ! ready_busy ) { $document.trigger( 'action.activate_tab', [ui.newPanel] ); $document.trigger( 'action.init_hidden_elements', [ui.newPanel] ); $window.trigger('resize'); } } } ); if ( $self.hasClass( 'planty_tabs_ajax' ) ) { $self.on( 'tabsbeforeactivate', function( event, ui ) { if ( ui.newPanel.data( 'need-content' ) ) { planty_tabs_ajax_content_loader( ui.newPanel, 1, ui.oldPanel ); } } ); $self.on( 'click', '.nav-links a', function(e) { var $self = jQuery( this ); var panel = $self.parents( '.planty_tabs_content' ); var page = 1; var href = $self.attr( 'href' ); var pos = -1; if ( ( pos = href.lastIndexOf( '/page/' ) ) != -1 ) { page = Number( href.substr( pos + 6 ).replace( "/", "" ) ); if ( ! isNaN( page )) { page = Math.max( 1, page ); } } planty_tabs_ajax_content_loader( panel, page ); e.preventDefault(); return false; } ); } } ); } } function planty_tabs_ajax_content_loader(panel, page, oldPanel) { if (panel.html().replace( /\s/g, '' ) === '') { var height = oldPanel === undefined ? panel.height() : oldPanel.height(); if (isNaN( height ) || height < 100) { height = 100; } panel.html( '' ); } else { panel.find( '> *' ).addClass( 'planty_tab_content_remove' ); } panel.data( 'need-content', false ).addClass( 'planty_loading' ); jQuery.post( PLANTY_STORAGE['ajax_url'], { nonce: PLANTY_STORAGE['ajax_nonce'], action: 'planty_ajax_get_posts', blog_template: panel.data( 'blog-template' ), blog_style: panel.data( 'blog-style' ), posts_per_page: panel.data( 'posts-per-page' ), cat: panel.data( 'cat' ), parent_cat: panel.data( 'parent-cat' ), post_type: panel.data( 'post-type' ), taxonomy: panel.data( 'taxonomy' ), page: page } ).done( function( response ) { panel.removeClass( 'planty_loading' ); var rez = {}; try { rez = JSON.parse( response ); } catch (e) { rez = { error: PLANTY_STORAGE['msg_ajax_error'] }; console.log( response ); } if (rez.error !== '') { panel.html( '